package com.xoa.controller.inv;

import com.xoa.dao.crm.CustomerMapper;
import com.xoa.model.crm.Customer;
import com.xoa.model.users.Users;
import com.xoa.service.crm.CustomerService;
import com.xoa.service.users.UsersService;
import com.xoa.util.CookiesUtil;
import com.xoa.util.ToJson;
import com.xoa.util.common.session.SessionUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/profit")
public class ProfitController {

    @Resource
    private CustomerService customerService;

    @Resource
    private UsersService usersService;


    //客户利润
    @ResponseBody
    @RequestMapping("/customerProfit")
    public ToJson<Customer> customerProfit(String month,
                                           String customerId,
                                           String enterId,
                                           String year,
                                           String day,
                                           String page,
                                           String limit,
                                           String warehouseId,
                                           String userId
    ){
        return customerService.findCustomerProfit(month,customerId,enterId,year,day,page,limit,warehouseId,userId);
    }

    //员工销售业绩
    @ResponseBody
    @RequestMapping("/employeeSales")
    public  ToJson<Users> employeeSales(String month,
                                        String customerId,
                                        String enterId,
                                        String year,
                                        String day,
                                        String page,
                                        String limit,
                                        String warehouseId,
                                        String userId){
        return customerService.findEmployeeSales(month,customerId,enterId,year,day,page,limit,warehouseId,userId);
    }

    /**
     *
     * @param month
     * @param userId
     * @param year
     * @param day
     * @param flag   0按销售金额提成 1按已付金额提成  2按销售利润提成  3按销售数量提成  4按还款金额提成
     * @return
     */
    @ResponseBody
    @RequestMapping("/employeeCommission")
    public ToJson<Users> employeeCommission(String month, String userId,String year,String day,String flag,String price,String warehouseId,String limit,String page){

        return customerService.findEmployeeCommission(month,userId,year,day,flag,price,warehouseId,limit,page);
    }


}
